package com.homegoods.home.item;

import com.alibaba.android.arouter.launcher.ARouter;
import com.homegoods.aroutercomment.ARouterPath;
import com.homegoods.classify.model.Constant;
import com.homegoods.home.R;
import com.homegoods.home.model.NewProductModel;
import com.kedll.library.mvp.BaseItem;
import com.kedll.library.util.MyUtils;

/**
 * @author QiQi
 * @ClassName: NewProductItem
 * @date 2018/9/6
 * @description
 */
public class NewProductItem extends BaseItem<NewProductModel> {
    public NewProductItem(NewProductModel data) {
        super(data);
//        MyUtils.calculateTag();
        setOnClickListener(v -> {
            ARouter.getInstance()
                    .build(ARouterPath.PATH_GOODS_DETAIL)
                    .withString("sid", data.getSid())
                    .navigation();
        });
    }

    public String getImgUrl() {
        return Constant.SERVER_URL + getData().getSmallPic();
    }

    public String getTitle() {
        return getData().getTitle();
    }

    public String getActPrice() {
        return String.format("￥%s", MyUtils.getActivityPrice(getData().getNowPrice(), getData().getPayCake()));
    }

    public String getDayang() {
        return String.format("%s积分", MyUtils.getActivityTegral(getData().getNowPrice(), getData().getPayCake()));
    }

    public String getCurrentprice() {
        return String.format("￥%s", getData().getNowPrice());
    }

    @Override
    public int getLayout() {
//        return R.layout.home_item_new_product;    //del shibo.zheng 19/06/24
        return R.layout.home_item_show_product;     //add shibo.zheng 19/06/24
    }
}
